package com.jerry.huihome.module.find.fragment;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.jerry.huihome.R;
import com.jerry.huihome.base.BaseFragment;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by Administrator on 2016/5/10.
 */
public class DesignerFragment extends BaseFragment {

    @BindView(R.id.iv_up_left_white)
    ImageView ivUpLeftWhite;
    @BindView(R.id.iv_up_right_white)
    ImageView ivUpRightWhite;
    private DesignerDetailFragment fragment;

    private boolean isDesignerSelect = true;
    private boolean isForemanSelect = false;
    @Override
    protected int getLayoutId() {
        return R.layout.fragment_designer;
    }

    public void showImg(){
        if (isDesignerSelect == true){
            ivUpLeftWhite.setVisibility(View.VISIBLE);
            ivUpRightWhite.setVisibility(View.INVISIBLE);
        }else {
            ivUpLeftWhite.setVisibility(View.INVISIBLE);
            ivUpRightWhite.setVisibility(View.VISIBLE);
        }
    }
    @Override
    protected void initViews() {
        fragment = BaseFragment.newInstance(DesignerDetailFragment.class, null);
        getChildFragmentManager().beginTransaction().replace(R.id.fl_designer, fragment).commit();
    }

    @OnClick(R.id.tv_designers)
    public void onClickDesigne(TextView textView) {
        getChildFragmentManager().beginTransaction().replace(R.id.fl_designer, fragment).commit();
        isDesignerSelect = true;
        isForemanSelect = false;
        showImg();
    }

    @OnClick(R.id.tv_works)
    public void onClickWorks(TextView textView) {
        WorksFragment worksFragment = BaseFragment.newInstance(WorksFragment.class, null);
        getChildFragmentManager().beginTransaction().replace(R.id.fl_designer, worksFragment).commit();
        isForemanSelect = true;
        isDesignerSelect = false;
        showImg();
    }

}
